package com.usian.user.controller;

import com.usian.api.user.UserRelationControllerApi;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.UserRelationDto;
import com.usian.model.user.pojos.ApUser;
import com.usian.user.service.ApUserFollowService;
import com.usian.user.service.ApUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/user")
public class UserRelationController implements UserRelationControllerApi {

    @Autowired
    private ApUserService apUserService;

    @Autowired
    private ApUserFollowService apUserFollowService;

    @Override
    @PostMapping("/user_follow")
    public ResponseResult follow(@RequestBody UserRelationDto dto) {
        return apUserFollowService.follow(dto);
    }

    @Override
    @GetMapping("/{id}")
    public ApUser findUserById(@PathVariable Integer id) {
        return apUserService.getById(id);
    }
}
